< previous page page_266 next page >

Page 266
e10a6a0a59f035e870d90cca05b85fce.gif
    Loop

    ' Finish up.
    pic_old.Picture = pic_new.Picture
    Wiping = False
End Sub
The Wipes.bas module contains routines to push images from left to right, right to left, top to bottom, and bottom to top.
One interesting combination pushes a blank image over the current one from left to right and then pushes a new image over the blank one from right to left. This gives an effect similar to that of a slide projector. The old slide disappears moving to the right, and the new slide appears moving to the left. The following code shows how a program can use the routines in Wipes.bas to make this kind of transition. Here picCanvas is the visible display area, picNew contains the new image, and picBlank contains a blank picture.
e10a6a0a59f035e870d90cca05b85fce.gif
PushLeftToRight picBlank, picCanvas, _
    ms_per_frame, pixels_per_frame 
PushRightToLeft picNew, picCanvas, _
    ms_per_frame, pixels_per_frame
Tile Overs
In a tile over, the program replaces the old image gradually, using rectangular blocks of the new image. Figure 9.12 shows program Scenes after it has partially replaced an image with randomly selected tiles from the new image.
Different tile overs display the tiles in the new image in different orders. Program Scenes demonstrates three tile overs. A random tile over selects the next tile to display randomly.
The following code shows how program Scenes displays random tile overs. Subroutine TileRandom begins by creating chunk_row and chunk_col arrays to hold the rows and columns of the tiles it will present. It initializes the entries in these arrays in their most natural order: (0, 0), (0, 1), . . ., (1, 0), (1, 1), and so forth.
Next TileRandom randomizes the entries in these arrays. For each entry in the array, the program selects another entry that has not yet been positioned. It then swaps the two entries. This produces a random arrangement of the tile rows and columns.
TileRandom then calls subroutine DisplayTiles to display the tiles in their randomized order, waiting the right amount of time between them.
e10a6a0a59f035e870d90cca05b85fce.gif
' Tile the pic_old with pic_new randomly.
Public Sub TileRandom( _
    ByVal pic_new As PictureBox, _
    ByVal pic_old As PictureBox, _
    ByVal ms_per_frame As Long, _
    ByVal divisions_per_side As Integer)

 
< previous page page_266 next page >